package de.shortys.myhome.api.view.components.sidebar;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.Observable;

import javax.swing.JPanel;

import net.miginfocom.swing.MigLayout;

public class ApplicationSidebar extends AbstractSidebar {

	private JPanel sidebarPane;

	@Override
	public void update(Observable o, Object arg) {
		// Empty
	}

	@Override
	public void add(AbstractSidebarItem item) {
		sidebarPane.add(item.build(), "dock north");
	}

	@Override
	public void remove(AbstractSidebarItem item) {
		sidebarPane.remove(item.build());
	}

	@Override
	public void revalidate() {
		sidebarPane.revalidate();
		sidebarPane.repaint();
	}

	@Override
	protected void buildComponents() {
		setPadding(0, 5, 5, 0);
		getContentPane().setLayout(new BorderLayout());
		getContentPane().setPreferredSize(new Dimension(250, 0));
		getContentPane().setOpaque(false);
		sidebarPane = new JPanel();
		sidebarPane.setLayout(new MigLayout("", "0[grow]", "0[grow]"));
		sidebarPane.setOpaque(false);
		getContentPane().add(sidebarPane);
	}

	@Override
	public void clear() {
		// TODO Auto-generated method stub
		
	}
}
